'''
Description: 
Author: Zilu
Date: 2021-11-03 20:23:42
Version: 
LastEditTime: 2021-11-03 21:14:11
LastEditors: Zilu
'''
# list的增删查改
classmates = ["Alice","Bob","Charlie","David"]
print(classmates[0])
print(classmates[-1])
classmates.pop()    # 删除末尾
classmates.pop(1)   # 删除第二个
classmates.append("Emy")
classmates.insert(0,"John")
classmates[2] = "Christine"

# 元组tuple和list很相似，但定义后不可修改，没有增加、删除和插入等方法，但可以用下标查询
roommates = ("Johnson","Mike","Zip","Nancy")
room = (1,)     # 定义一个数的元组要使用逗号 ","
nope = ()       # 定义空元组
print(roommates[1])

# 这里tuple的不变是指每个元素的指向不能变
volatile = (1,2,['a','b'])
volatile[2][0] = 'X'
volatile[2][1] = 'Y'



